import React from "react";
import './TodoFooter.css';
import store from "../../../redux/store";
import { checkAllTodoAction, removeDoneTodosAction } from "../../../redux/reducers/todoReducer";

export default function TodoFooter() {
  return (
    <div className="todo-footer">
      <label>
        <input type="checkbox" onChange={(e) => {
          store.dispatch(checkAllTodoAction(e.target.checked));
        }} />
      </label>
      <span>
        <span>已完成0</span> / 全部2
      </span>
      <button className="btn btn-danger" onClick={() => {
        store.dispatch(removeDoneTodosAction());
      }}>清除已完成任务</button>
    </div>
  );
}
